gdk: Allow display subclasses to override the type used for windows
authorBenjamin Otte <otte@redhat.com>
Tue, 21 Dec 2010 02:13:55 +0000 (03:13 +0100)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 21 Dec 2010 17:07:08 +0000 (12:07 -0500)
commitaf7afbbe06690281d9703aaab7d1b9522cede3cb
tree3ac45e7196099b9604acb724a3477f20c37594ba
parent3036922b3d7f58757f67ce7a87c7781fe1b3c46e
gdk: Allow display subclasses to override the type used for windows

We want to have different window types for different displays, so we can
write code like this:

  #if GDK_WINDOWING_X11
    if (GDK_IS_X11_WINDOW (window))
      {
        /* do x11 stuff */
      }
    else
  #endif
  #if GDK_WINDOWING_WAYLAND
    if (GDK_IS_WAYLAND_WINDOW (window))
      {
        /* do wayland stuff */
      }
    else
  #endif
      {
        /* do stuff for unsupported system */
    }

This requires different GdkWindow types and we currently don't have
that, as only the GdkWindowImpl differs. With this method, every backend
defines a custom type that's just a simple subclass of GdkWindow. This
way GdkWindow behaves like all the other types (visuals, screens,
displays) and we can write code like the above.
gdk/gdkdisplay.c
gdk/gdkdisplayprivate.h